package com.atguigu.lease.model.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;


public enum ItemType implements BaseEnum {

    APARTMENT(1, "公寓"),

    ROOM(2, "房间");

//| 注解           | 来自           | 作用对象  | 用途             |
//| ------------ | ------------ | ----- | -------------- |
//| `@EnumValue` | MyBatis-Plus | 字段    | 指定存数据库的值       |
//| `@JsonValue` | Jackson      | 字段/方法 | 指定序列化为 JSON 的值 |
    @EnumValue
    @JsonValue
    private Integer code;
    private String name;

    @Override
    public Integer getCode() {
        return this.code;
    }


    @Override
    public String getName() {
        return name;
    }

    ItemType(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

}
